<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <style>
    .box {
      width: 200px;
      height: 10px;
      border: 1px solid red;
      border-radius: 5px;
    }
    .box_in {
      width: 40%;
      height: 10px;
      border-radius: 2px;
      background-color: red;
      /* 给孩子加 */
      transition: width 0.3s;
    }
    /* 当鼠标悬停在 box 上，box_in 的宽度变为 100% */
    .box:hover .box_in {
      width: 100%;
      height: 10px;
    }
  </style>
  <body>
    <div class="box">
      <div class="box_in"></div>
    </div>
  </body>
</html>
